<?php
/*
 * Created on 2013-9-20
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
	if( array_key_exists('name',$_REQUEST) && array_key_exists('password',$_REQUEST) )
	{
		$name = $_REQUEST['name'];
		$password = $_REQUEST['password'];
		
		if(strlen($name)>0 && strlen($password)>0)
		{
			include ("conn.php");
		
			$query = "select count(*) as total from userInfo where name = '$name'";
			$res = $mysql -> getData( $query );
		
			if($res[0]['total']>0)
			{
				echo '用户名已注册，请修改';
			} 
			else
			{
				$query = "INSERT INTO userInfo VALUES ('$name', '$password')";
				$mysql -> runSql( $query );
				echo $name.'注册成功~';
			}
		}
		else
		{
			echo '用户名或密码填写错误，请修改';
		}
	}
	else
	{
		echo 'Register faild';
	}
?>
